package com.zenitera.bigdata.transform;

import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * shuffle
 * 把流中的元素随机打乱. 对同一个组数据, 每次执行得到的结果都不同
 */
public class Flink09_TransForm_shuffle {
    public static void main(String[] args) {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        env
                .fromElements(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
                .shuffle()
                .print();
        try {
            env.execute();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
